<?php
namespace app\first\controller;

/**
 * Class Column
 * @title 栏目相关
 * @url /v1/column
 * @desc  栏目相关
 * @version 1.0
 * @package app\first\column
 * @route('v1/column')->allowCrossDomain()
 */
class Column extends Base{
    //是否开启授权认证,默认开启
    public $apiAuth = true;
    /*
    * 需要附加的其他方法,比如:topList,newList
    * protected $extraActionList = ['topList','newList',...];
    * 已经对核心的类进行了重写,扩展的新方法会自动添加到认证中,无需再手动书写
    */
    protected $extraActionList = [];
    protected $model = null;
    public function __construct(){
        parent::__construct();
        $this->model = new \app\first\model\Column;
    }

    /**
     * @return \think\facade\Response|\think\response\Json|\think\response\Jsonp|\think\response\Redirect|\think\response\Xml
     * @throws \think\Exception\DbException
     * @title 获取栏目
     * @method index
     * @return json data 所有栏目
     */
    public function index(){
        $list = $this->model->field('id,title')->all();
        return $this->sendSuccess($list);
    }
}